<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>发现-农业知识交流论坛</title>

    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <link rel="stylesheet" th:href="@{/css/mycss.css}">
    <link rel="stylesheet" th:href="@{/zplayer/css/zplayer.min.css}">
    <script th:src="@{/zplayer/js/zplayer.min.js}"></script>
    <link rel="stylesheet" href="//at.alicdn.com/t/font_2080705_x7u3h1yrrfc.css">
    <style>
        /* 卡片样式 */
        .blog-card {
            margin-bottom: 24px;
            border: 1px solid #e9ecef;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
            overflow: hidden;
        }

        .blog-card:hover {
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
            transform: translateY(-2px);
        }

        .blog-card .card-body {
            padding: 24px;
        }

        .blog-card .card-title {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 12px;
            line-height: 1.4;
            color: #212529;
        }

        .blog-card .card-title a {
            color: #212529;
            transition: color 0.2s ease;
        }

        .blog-card .card-title a:hover {
            color: #4B7F52;
            text-decoration: none;
        }

        .blog-card .card-subtitle {
            display: flex;
            align-items: center;
            font-size: 14px;
            color: #6c757d;
            margin-bottom: 16px;
        }

        .blog-card .card-subtitle img {
            margin-right: 8px;
        }

        .blog-card .card-subtitle a {
            margin-right: 8px;
            color: #4B7F52;
            font-weight: 500;
        }

        .blog-card .card-subtitle a:hover {
            text-decoration: underline;
        }

        .blog-card .original-tag {
            background-color: #e9f5e9;
            color: #4B7F52;
            border-radius: 4px;
            padding: 2px 6px;
            font-size: 12px;
            margin-right: 8px;
        }

        .blog-card .post-date {
            font-size: 12px;
            color: #999;
        }

        .blog-card .card-text {
            font-size: 15px;
            line-height: 1.7;
            color: #495057;
            margin-bottom: 16px;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .blog-card .card-footer {
            background-color: #f8f9fa;
            border-top: 1px solid #e9ecef;
            padding: 16px 24px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .blog-card .card-footer span {
            display: flex;
            align-items: center;
            color: #6c757d;
        }

        .blog-card .card-footer i {
            margin-right: 4px;
            color: #999;
        }

        /* 分页样式 */
        .pagination .page-link {
            border-radius: 4px;
            margin: 0 2px;
            color: #4B7F52;
            transition: all 0.2s ease;
        }

        .pagination .page-item.active .page-link {
            background-color: #4B7F52;
            border-color: #4B7F52;
            color: white;
        }

        .pagination .page-link:hover {
            background-color: #f8f9fa;
        }

        /* 侧边栏模块样式 */
        .sidebar-module {
            margin-bottom: 20px;
            border: 1px solid #e9ecef;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            overflow: hidden;
        }

        .sidebar-header {
            padding: 12px 16px;
            background-color: #f8f9fa;
            border-bottom: 1px solid #e9ecef;
            font-weight: 600;
            color: #4B7F52;
        }

        .sidebar-content {
            padding: 16px;
        }

        /* 热门话题样式 */
        .topic-item {
            display: flex;
            align-items: center;
            padding: 8px 0;
            transition: all 0.2s ease;
        }

        .topic-item:hover {
            background-color: #f8f9fa;
            padding-left: 8px;
        }

        .topic-number {
            width: 20px;
            height: 20px;
            border-radius: 4px;
            background-color: #e9f5e9;
            color: #4B7F52;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            margin-right: 10px;
        }

        /* 活跃用户样式 */
        .user-item {
            display: flex;
            align-items: center;
            padding: 8px 0;
            transition: all 0.2s ease;
        }

        .user-item:hover {
            background-color: #f8f9fa;
            padding-left: 8px;
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            margin-right: 10px;
        }

        .user-name {
            font-size: 14px;
            font-weight: 500;
            color: #212529;
        }

        .user-posts {
            font-size: 12px;
            color: #6c757d;
        }
    </style>
</head>
<body>
<div th:replace="~{common/header::header(activeUrl='discover')}"></div>

<main role="main">

    <div class="container" th:fragment="discover">

        <div class="row">
            <!-- 左侧菜单 -->
            <div class="col-md-2">
                <div role="navigation" th:replace="index::bar">
                </div>
            </div>
            <!-- 中间区域 -->
            <div class="col-md-8">

                <br>
                <hr class="layui-bg-blue">

                <div class="blog-main">

                    <div class="my-3 p-3 bg-white rounded shadow-sm">

                        <div th:if="${blogs.getDatas().size()<=0}">
                            <div class="media text-muted pt-3">暂时没有新的发现~ &emsp;&emsp;
                            </div>
                        </div>
                        <div th:if="${blogs.getDatas().size()>0}">
                            <div th:each="blog:${blogs.getDatas()}" class="blog-card card">
                                <div class="card-body">
                                    <!-- 标题 -->
                                    <h5 class="card-title">
                                        <a th:text="${blog.getTitle()}"
                                           th:href="@{'/article/read/'+${blog.getBid()}+'/'+${blog.getAuthorId()}}"
                                           class="text-dark font-weight-bold text-decoration-none d-block">
                                        </a>
                                    </h5>
                                    <!-- 头像、作者、原创标签和日期 -->
                                    <h6 class="card-subtitle mb-2 text-muted">
                                        <img th:src="${blog.getAuthorAvatar()}" style="border-radius: 50%;" width="24" height="24" alt="作者头像">
                                        <a th:text="${blog.getAuthorName()}"
                                           th:href="@{'/article/'+${blog.getAuthorId()}}"
                                           class="text-dark font-weight-bold text-decoration-none" target="_blank">
                                        </a>
                                        <span th:if="${blog.getOriginal()==1}" class="original-tag">
                                            原创
                                        </span>
                                        <span class="post-date" th:text="${#dates.format(blog.getUpdateTime(),'yyyy-MM-dd')}">
                                        </span>
                                    </h6>
                                    <!-- 内容摘要 -->
                                    <p class="card-text">
                                        <span th:text="${#strings.abbreviate(blog.getContent(),150)}">
                                        </span>
                                    </p>
                                </div>
                                <div class="card-footer">
                                    <!-- 评论数 -->
                                    <span>
                                        <i class="iconfont icon-pinglunliang"></i>
                                        [[${blog.getComment()}]]
                                    </span>
                                    <!-- 浏览量 -->
                                    <span>
                                        <i class="iconfont icon-liulan"></i>
                                        [[${blog.getViews()}]]
                                    </span>
                                </div>
                            </div>

                            <!-- 分页 -->
                            <nav aria-label="Page navigation example" class="mt-6">
                                <ul class="pagination justify-center pagination-sm">
                                    <li th:class="${blogs.getPageInfo().isHasPreviousPage()==true?'page-item':'page-item disabled'}">
                                        <a class="page-link" th:href="@{'/discover/'+${blogs.getPageInfo().pageNum -1}+'/10'}" tabindex=""><&nbsp;</a>
                                    </li>
                                    <li class="page-item" th:if="${blogs.getPageInfo().isHasPreviousPage()}">
                                        <a class="page-link" th:href="@{'/discover/'+${blogs.getPageInfo().pageNum -1}+'/10'}" th:text="${blogs.getPageInfo().pageNum -1}"></a>
                                    </li>
                                    <li class="page-item active">
                                        <a class="page-link" th:href="@{'/discover/'+${blogs.getPageInfo().pageNum}+'/10'}" th:text="${blogs.getPageInfo().pageNum}"></a>
                                    </li>
                                    <li class="page-item" th:if="${blogs.getPageInfo().isHasNextPage()}">
                                        <a class="page-link" th:href="@{'/discover/'+${blogs.getPageInfo().pageNum +1}+'/10'}" th:text="${blogs.getPageInfo().pageNum +1}"></a>
                                    </li>
                                    <li th:class="${blogs.getPageInfo().isHasNextPage()==true?'page-item':'page-item disabled'}">
                                        <a class="page-link"  th:href="@{'/discover/'+${blogs.getPageInfo().pageNum +1}+'/10'}" >&nbsp;></a>
                                    </li>
                                </ul>
                            </nav>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 右侧区域 -->
            <div class="col-md-2">
                <!-- 热门话题 -->
                <div class="sidebar-module">
                    <div class="sidebar-header">
                        <i class="iconfont icon-huati mr-1"></i> 热门话题
                    </div>
                    <div class="sidebar-content">
                        <div class="topic-item">
                            <div class="topic-number">1</div>
                            <a href="#" class="text-gray-700 hover:text-primary transition-colors">智能农业技术应用</a>
                        </div>
                        <div class="topic-item">
                            <div class="topic-number">2</div>
                            <a href="#" class="text-gray-700 hover:text-primary transition-colors">有机肥料的使用方法</a>
                        </div>
                        <div class="topic-item">
                            <div class="topic-number">3</div>
                            <a href="#" class="text-gray-700 hover:text-primary transition-colors">农作物病虫害防治</a>
                        </div>
                        <div class="topic-item">
                            <div class="topic-number">4</div>
                            <a href="#" class="text-gray-700 hover:text-primary transition-colors">节水灌溉技术分享</a>
                        </div>
                        <div class="topic-item">
                            <div class="topic-number">5</div>
                            <a href="#" class="text-gray-700 hover:text-primary transition-colors">农产品电商运营经验</a>
                        </div>
                    </div>
                </div>

                <!-- 活跃用户 -->
                <div class="sidebar-module">
                    <div class="sidebar-header">
                        <i class="iconfont icon-huodong mr-1"></i> 活跃用户
                    </div>
                    <div class="sidebar-content">
                        <div class="user-item">
                            <img src="https://picsum.photos/seed/user1/48/48" class="user-avatar" alt="用户头像">
                            <div>
                                <div class="user-name">农业专家</div>
                                <div class="user-posts">发表了28篇文章</div>
                            </div>
                        </div>
                        <div class="user-item">
                            <img src="https://picsum.photos/seed/user2/48/48" class="user-avatar" alt="用户头像">
                            <div>
                                <div class="user-name">种植达人</div>
                                <div class="user-posts">发表了23篇文章</div>
                            </div>
                        </div>
                        <div class="user-item">
                            <img src="https://picsum.photos/seed/user3/48/48" class="user-avatar" alt="用户头像">
                            <div>
                                <div class="user-name">新农人</div>
                                <div class="user-posts">发表了19篇文章</div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 推荐标签 -->
                <div class="sidebar-module">
                    <div class="sidebar-header">
                        <i class="iconfont icon-biaoqian mr-1"></i> 推荐标签
                    </div>
                    <div class="sidebar-content">
                        <div class="d-flex flex-wrap gap-2">
                            <a href="#" class="px-3 py-1 text-xs bg-primary/10 text-primary rounded-full hover:bg-primary/20 transition-colors">
                                农业技术
                            </a>
                            <a href="#" class="px-3 py-1 text-xs bg-primary/10 text-primary rounded-full hover:bg-primary/20 transition-colors">
                                种植经验
                            </a>
                            <a href="#" class="px-3 py-1 text-xs bg-primary/10 text-primary rounded-full hover:bg-primary/20 transition-colors">
                                市场行情
                            </a>
                            <a href="#" class="px-3 py-1 text-xs bg-primary/10 text-primary rounded-full hover:bg-primary/20 transition-colors">
                                政策解读
                            </a>
                            <a href="#" class="px-3 py-1 text-xs bg-primary/10 text-primary rounded-full hover:bg-primary/20 transition-colors">
                                农机具
                            </a>
                            <a href="#" class="px-3 py-1 text-xs bg-primary/10 text-primary rounded-full hover:bg-primary/20 transition-colors">
                                农产品
                            </a>
                        </div>
                    </div>
                </div>
            </div>

        </div>

        <hr class="layui-bg-blue">

        <div th:replace="common/musicPlayer::musicPlayer"></div>
    </div>
</main>

<div th:replace="~{common/footer::footer}"></div>

<a class="to-top"><i class="iconfont icon-fanhuidingbu1" style="font-size:50px;color: blue"></i></a>
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/js/toTop.js}"></script>
<script th:src="@{/layui/layui.all.js}"></script>
</body>
</html>